* Wealth index calculation. Juste Nitiema, 05/23/2022. Gabon DHS 2019-21. cd 'C:\Users\21180\OneDrive - ICF\Projects\Analysis\Wealth Index Construction\GA81\wealth'. include file='wealth_assets.sps'. missing values QH120 (99.9). execute. set tvars=both. * Macro definitions to perform some recoding automatically. * Note: Do not use an asterisk in front of a macro name to try to comment it out - it will run any way because of the way the macros are expanded. * Delete the line instead or change the spelling of the macro in the comment. * Do not use the names of macros in comments - they will also be expanded too, and likely will fail. *{Create binary variables based on condition and give label }. define dichotomize( !positional !enclose('(',')') / !positional !tokens(1) / !positional !tokens(1) ) compute !2=0. if (!1) !2=1. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *(Separate shared toilets from non-shared toilets). define shared_fac( !positional !tokens(1) / !positional !tokens(1) / !positional !tokens(1) ). compute !2 = 0. do if (QH110=1). + if (!1=1) !2 = 1. + compute !1 = 0. end if. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *{Reset missing values to 'does not have', change 2 code to 0}. define no2zero( !positional !tokens(1) ) if (missing(!1) | !1<>1) !1=0. value labels !1 0 'No' 1 'Yes'. !enddefine. *{Construct Variables}. * Source of drinking water. dichotomize (QH101=11) QH101_11 "Source of drinking water: Robinet dans logement". dichotomize (QH101=12) QH101_12 "Source of drinking water: Robinet dans cour/parcelle". dichotomize (QH101=13) QH101_13 "Source of drinking water: Robinet chez un voicin". dichotomize (QH101=14) QH101_14 "Source of drinking water: Robinet public/Borne fontaine". dichotomize (QH101=15) QH101_15 "Source of drinking water: Eau achetée au robinet". dichotomize (QH101=16) QH101_16 "Source of drinking water: Robinet (compteur) personnel hors cour/parcelle". dichotomize (QH101=21) QH101_21 "Source of drinking water: Puit à pompe ou forage/ hydraulique villageoise". dichotomize (QH101=31) QH101_31 "Source of drinking water: Puits protégé". dichotomize (QH101=32) QH101_32 "Source of drinking water: Puits non protégé". dichotomize (QH101=41) QH101_41 "Source of drinking water: Source protégée". dichotomize (QH101=42) QH101_42 "Source of drinking water: Source non protégée". dichotomize (QH101=51) QH101_51 "Source of drinking water: Eau de pluie". dichotomize (QH101=61) QH101_61 "Source of drinking water: Camion citerne". dichotomize (QH101=71) QH101_71 "Source of drinking water: Eau de surface (rivière/barrage/lac/mare/fleuve/canal/canal d'irrigation)". dichotomize (QH101=81) QH101_81 "Source of drinking water: Eau en bouteille". dichotomize (QH101=82) QH101_82 "Source of drinking water: Eau de sachet". dichotomize (QH101=96) QH101_96 "Source of drinking water: Autre". * Type of toilet facility. dichotomize (QH109=11) QH109_11 "Type of toilet facility: Chasse d'eau connectée à un systeme d'égout". dichotomize (QH109=12) QH109_12 "Type of toilet facility: Chasse d'eau connectée à une fosse septique". dichotomize (QH109=13) QH109_13 "Type of toilet facility: Chasse d'eau connectée à une fosse d'aissances". dichotomize (QH109=14) QH109_14 "Type of toilet facility: Chasse d'eau connectée à quelque chose d'autre". dichotomize (QH109=15) QH109_15 "Type of toilet facility: Chasse d'eau connectée à ne sait pas où". dichotomize (QH109=21) QH109_21 "Type of toilet facility: Fosses d'aisances améliorée Auto-aérée". dichotomize (QH109=22) QH109_22 "Type of toilet facility: Fosses d'aisances avec dalle". dichotomize (QH109=23) QH109_23 "Type of toilet facility: Fosses d'aisances sans dalle trou ouvert". dichotomize (QH109=31) QH109_31 "Type of toilet facility: Toilettes à compostage". dichotomize (QH109=41) QH109_41 "Type of toilet facility: Seau/tinette". dichotomize (QH109=51) QH109_51 "Type of toilet facility: Toilettes/latrines suspendues". dichotomize (QH109=61) QH109_61 "Type of toilet facility: Pas de toilettes/nature". dichotomize (QH109=96) QH109_96 "Type of toilet facility: Autre". shared_fac QH109_11 QH109_11_sh "Type of toilet facility: Chasse d'eau connectée à un systeme d'égout - shared". shared_fac QH109_12 QH109_12_sh "Type of toilet facility: Chasse d'eau connectée à une fosse septique - shared". shared_fac QH109_13 QH109_13_sh "Type of toilet facility: Chasse d'eau connectée à une fosse d'aissances - shared". shared_fac QH109_14 QH109_14_sh "Type of toilet facility: Chasse d'eau connectée à quelque chose d'autre - shared". shared_fac QH109_15 QH109_15_sh "Type of toilet facility: Chasse d'eau connectée à ne sait pas où - shared". shared_fac QH109_21 QH109_21_sh "Type of toilet facility: Fosses d'aisances améliorée Auto-aérée - shared". shared_fac QH109_22 QH109_22_sh "Type of toilet facility: Fosses d'aisances avec dalle - shared". shared_fac QH109_23 QH109_23_sh "Type of toilet facility: Fosses d'aisances sans dalle trou ouvert - shared". shared_fac QH109_31 QH109_31_sh "Type of toilet facility: Toilettes à compostage - shared". shared_fac QH109_41 QH109_41_sh "Type of toilet facility: Seau/tinette - shared". shared_fac QH109_51 QH109_51_sh "Type of toilet facility: Toilettes/latrines suspendues - shared". shared_fac QH109_96 QH109_96_sh "Type of toilet facility: Autre - shared". * Type of cooking fuel. dichotomize (QH113=1) QH113_1 "Type of cooking fuel: Électricité". dichotomize (QH113=2) QH113_2 "Type of cooking fuel: Gaz butane". dichotomize (QH113=3) QH113_3 "Type of cooking fuel: Pétrole". dichotomize (QH113=4) QH113_4 "Type of cooking fuel: Biogaz". dichotomize (QH113=5) QH113_5 "Type of cooking fuel: Charbon de bois". dichotomize (QH113=6) QH113_6 "Type of cooking fuel: Bois de chauffe". *ichotomize (QH113=7) QH113_7 "Type of cooking fuel: Sciure/copeaux de bois". *ichotomize (QH113=8) QH113_8 "Type of cooking fuel: Paille/branchages/herbes". *ichotomize (QH113=9) QH113_9 "Type of cooking fuel: Résidus agricoles". dichotomize (QH113=95) QH113_95 "Type of cooking fuel: Pas de repas préparé dans le ménage". dichotomize (QH113=7 | QH113=8 | QH113=96) QH113_96 "Type of cooking fuel: Autre". * Cows/bulls. if (missing(QH118A) | QH117 <> 1) QH118A=0. missing values QH118A (99). compute QH118A_1 = (QH118A >= 1 & QH118A <= 4). compute QH118A_2 = (QH118A >= 5 & QH118A <= 98). compute QH118A_3 = (QH118A >= 10 & QH118A <= 98). variable labels QH118A_1 'Cows/bulls: 1-4' /QH118A_2 'Cows/bulls: 5-9' /QH118A_3 'Cows/bulls: 10+'. * Other cattle. if (missing(QH118B) | QH117 <> 1) QH118B=0. missing values QH118B (99). compute QH118B_1 = (QH118B >= 1 & QH118B <= 4). compute QH118B_2 = (QH118B >= 5 & QH118B <= 98). *ompute QH118B_3 = (QH118B >= 10 & QH118B <= 98). variable labels QH118B_1 'Other cattle: 1-4' /QH118B_2 'Other cattle: 5+'. * Horses/donkeys/mules. if (missing(QH118C) | QH117 <> 1) QH118C=0. missing values QH118C (99). compute QH118C_1 = (QH118C >= 1 & QH118C <= 4). *ompute QH118C_2 = (QH118C >= 5 & QH118C <= 9). *ompute QH118C_3 = (QH118C >= 10 & QH118C <= 98). variable labels QH118C_1 'Horses/donkeys/mules: 1-4'. * Goats. if (missing(QH118D) | QH117 <> 1) QH118D=0. missing values QH118D (99). compute QH118D_1 = (QH118D >= 1 & QH118D <= 4). compute QH118D_2 = (QH118D >= 5 & QH118D <= 98). *ompute QH118D_3 = (QH118D >= 10 & QH118D <= 98). variable labels QH118D_1 'Goats: 1-4' /QH118D_2 'Goats: 5+'. * Sheep. if (missing(QH118E) | QH117 <> 1) QH118E=0. missing values QH118E (99). compute QH118E_1 = (QH118E >= 1 & QH118E <= 4). compute QH118E_2 = (QH118E >= 5 & QH118E <= 9). compute QH118E_3 = (QH118E >= 10 & QH118E <= 98). variable labels QH118E_1 'Sheep: 1-4' /QH118E_2 'Sheep: 5-9' /QH118E_3 'Sheep: 10+'. * Chickens or other poultry. if (missing(QH118F) | QH117 <> 1) QH118F=0. missing values QH118F (99). compute QH118F_1 = (QH118F >= 1 & QH118F <= 9). compute QH118F_2 = (QH118F >= 9 & QH118F <= 29). compute QH118F_3 = (QH118F >= 30 & QH118F <= 98). variable labels QH118F_1 'Chickens or other poultry: 1-9' /QH118F_2 'Chickens or other poultry: 10-29' /QH118F_3 'Chickens or other poultry: 30+'. * Porcs. if (missing(QH118G) | QH117 <> 1) QH118G=0. missing values QH118G (99). compute QH118G_1 = (QH118G >= 1 & QH118G <= 4). compute QH118G_2 = (QH118G >= 5 & QH118G <= 9). compute QH118G_3 = (QH118G >= 10 & QH118G <= 98). variable labels QH118G_1 'Porcs: 1-4' /QH118G_2 'Porcs: 5-9' /QH118G_3 'Porcs: 10+'. * Lapins. if (missing(QH118H) | QH117 <> 1) QH118H=0. missing values QH118H (99). compute QH118H_1 = (QH118H >= 1 & QH118H <= 4). compute QH118H_2 = (QH118H >= 5 & QH118H <= 98). *ompute QH118H_3 = (QH118H >= 10 & QH118H <= 98). variable labels QH118H_1 'Lapins: 1-4' /QH118H_2 'Lapins: 5+'. * Hectares for agricultural land. compute landarea = QH120. if (missing(QH120) | QH120 >= 99.8) landarea = 99.9. if (missing(QH119) | QH119 <> 1) landarea=0. missing values landarea (99.9). * Electricity. no2zero QH121A. * Radio. no2zero QH121B. * Television. no2zero QH121C. * Telephone (non-mobile). no2zero QH121D. * Computer. no2zero QH121E. * Refrigerator. no2zero QH121F. * Tronçonneuse. no2zero QH121G. * Fer à repasser. no2zero QH121H. * Groupe électrogène. no2zero QH121I. * Chaine HiFi. no2zero QH121J. * Modem/boxe. no2zero QH121K. * Magnétoscope. no2zero QH121L. * Lecteur DVD/VCD. no2zero QH121M. * Congélateur. no2zero QH121N. * Four Micro-onde. no2zero QH121O. * Fusil de chasse. no2zero QH121P. * Filet de pêche. no2zero QH121Q. * Cusinière. no2zero QH121R. * Rechaud à Gaz. no2zero QH121S. * Ventilateur. no2zero QH121T. * Chauffe eau. no2zero QH121U. * Débroussailleuse. no2zero QH121V. * Machine à coudre. no2zero QH121W. * Climatiseur. no2zero QH121X. * Machine à laver. no2zero QH121Y. * Antenne/décodeur. no2zero QH121Z. * Lampe Torche. no2zero QH121AA. * Lampe à petrole. no2zero QH121AB. * Lampe à gaz. no2zero QH121AC. * Watch. no2zero QH122A. * Bicycle. no2zero QH122C. * Motorcycle or scooter. no2zero QH122D. * Car or Truck. no2zero QH122E. * Boat with a motor. no2zero QH122F. * Pirogue sans moteur. no2zero QH122G. * Pirogue à moteur/Hors-bord. no2zero QH122H. * Main floor material. dichotomize (QH142=11) QH142_11 "Main floor material: Terre/sable". dichotomize (QH142=21) QH142_21 "Main floor material: Planches en bois". dichotomize (QH142=31) QH142_31 "Main floor material: Parquet ou bois ciré". dichotomize (QH142=32) QH142_32 "Main floor material: Lino/Gerflex". dichotomize (QH142=33) QH142_33 "Main floor material: Carrelage". dichotomize (QH142=34) QH142_34 "Main floor material: Ciment". dichotomize (QH142=35) QH142_35 "Main floor material: Moquette". *ichotomize (QH142=96) QH142_96 "Main floor material: Autre". * Main roof material. dichotomize (QH143=11) QH143_11 "Main roof material: Plastique/Carton/tôle usée". dichotomize (QH143=12) QH143_12 "Main roof material: Ecorce/Paille/Palmes/Bambou". dichotomize (QH143=21) QH143_21 "Main roof material: Tôle seule". dichotomize (QH143=22) QH143_22 "Main roof material: Tôle et plafond". dichotomize (QH143=23) QH143_23 "Main roof material: Tuiles/Ardoise". dichotomize (QH143=24) QH143_24 "Main roof material: Béton". *ichotomize (QH143=25) QH143_25 "Main roof material: Shingles". dichotomize (QH143=25 | QH143=96) QH143_96 "Main roof material: Autre". * Main wall material. dichotomize (QH144=12) QH144_12 "Main wall material: Plastique/Carton/Tôle usée". dichotomize (QH144=21) QH144_21 "Main wall material: Ecorce/Paille/Palme/Bambou". dichotomize (QH144=31) QH144_31 "Main wall material: Terre battue". dichotomize (QH144=32) QH144_32 "Main wall material: Brique de terre". dichotomize (QH144=41) QH144_41 "Main wall material: Tôle". dichotomize (QH144=42) QH144_42 "Main wall material: Planche". dichotomize (QH144=43) QH144_43 "Main wall material: Semi-dur (dur et autre)". dichotomize (QH144=44) QH144_44 "Main wall material: Parpaing/Ciment". *ichotomize (QH144=96) QH144_96 "Main wall material: Autre". *{Members per sleeping room}. if (hhusual=0) hhusual=hhslept. if (QH116>0) memsleep=trunc(hhusual/QH116). if (QH116=0) memsleep=hhusual. if (missing(QH116) or QH116>=99 or memsleep>=98) memsleep=99. variable labels memsleep 'Number of members per sleeping room'. value labels memsleep 0 'Less than 1 per room'. formats memsleep (f2.0). missing values memsleep (99). * Compute urban and rural variables coded (1/0) for filters later. compute urban=(QHTYPE = 1). compute rural=(QHTYPE = 2). variable labels urban 'Urban' / rural 'Rural'. value labels urban 1 'Urban' / rural 1 'Rural'. formats urban rural (f1.0). execute. * Check on indicator variable creation. frequencies variables=QHTYPE to land. * Toilet facility by shared/not shared. crosstabs /tables=QH109 by QH110. * Land area by units - if there are separate units - need to convert them to one unit. *crosstabs /tables=QH120N by QH120U. * Dropped QH113_7, QH113_8, QH118B_3, QH118C_2, QH118C_3, QH118D_3, QH118H_3, QH142_96, QH143_25, QH144_96. frequencies variables= QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_82 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_96 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_15_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH109_96_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_23 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep QH118A_1 QH118A_2 QH118A_3 QH118B_1 QH118B_2 QH118C_1 QH118D_1 QH118D_2 QH118E_1 QH118E_2 QH118E_3 QH118F_1 QH118F_2 QH118F_3 QH118G_1 QH118G_2 QH118G_3 QH118H_1 QH118H_2 landarea . * Turn off weights before all factor analysis. weight off. * Name the dataset window for the HH data for use later. dataset name assets. save outfile='assets.sav'. *** Test Factor Analysis. filter off. execute. factor /variables QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_82 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_96 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_15_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_23 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep QH118A_1 QH118A_2 QH118A_3 QH118B_1 QH118B_2 QH118C_1 QH118D_1 QH118D_2 QH118E_1 QH118E_2 QH118E_3 QH118F_1 QH118F_2 QH118F_3 QH118G_1 QH118G_2 QH118G_3 QH118H_1 QH118H_2 landarea /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_82 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_96 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_15_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_23 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep QH118A_1 QH118A_2 QH118A_3 QH118B_1 QH118B_2 QH118C_1 QH118D_1 QH118D_2 QH118E_1 QH118E_2 QH118E_3 QH118F_1 QH118F_2 QH118F_3 QH118G_1 QH118G_2 QH118G_3 QH118H_1 QH118H_2 landarea /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /method=correlation. *** Common Factor analysis ***. ** Removed area-specific variables **. ** Agricultural animal variables excluded ** Land area excluded ** Any others ?. *** Common Factor Analysis. filter off. execute. factor /variables QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_82 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_96 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_15_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_23 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_82 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_96 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_15_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_23 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL com) /method=correlation. *** Urban Factor Analysis. filter off. filter by urban. execute. factor /variables QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_82 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_96 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_15_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_23 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_82 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_96 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_15_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_23 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL urb) /method=correlation. *** Rural Factor Analysis. filter off. filter by rural. execute. * Dropped QH101_82 QH109_96 QH109_15_sh QH143_23. factor /variables QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep QH118A_1 QH118A_2 QH118A_3 QH118B_1 QH118B_2 QH118C_1 QH118D_1 QH118D_2 QH118E_1 QH118E_2 QH118E_3 QH118F_1 QH118F_2 QH118F_3 QH118G_1 QH118G_2 QH118G_3 QH118H_1 QH118H_2 landarea /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 HOUSE LAND memsleep QH118A_1 QH118A_2 QH118A_3 QH118B_1 QH118B_2 QH118C_1 QH118D_1 QH118D_2 QH118E_1 QH118E_2 QH118E_3 QH118F_1 QH118F_2 QH118F_3 QH118G_1 QH118G_2 QH118G_3 QH118H_1 QH118H_2 landarea /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL rur) /method=correlation. * Label the created score variables. rename variables (com1 urb1 rur1=comscore urbscore rurscore). variable labels comscore 'Common wealth score' /urbscore 'Urban wealth score' /rurscore 'Rural wealth score'. * Add a variable used for linking later. filter off. string rowtype_ (A8). compute rowtype_ = 'EST'. * Calculate regressions. ** Area=urban. filter off. filter by urban. execute. * Declare a dataset to be written to in the regression. dataset declare urbancorv. * Run regression of comscore with urbscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter urbscore /outfile=corv(urbancorv). * Activate file of output from regression. dataset activate urbancorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=urbconst urbscore=urbcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = urbancorv /by ROWTYPE_. execute. * Calculate regressions. ** Area=rural. filter off. filter by rural. execute. * Declare a dataset to be written to in the regression. dataset declare ruralcorv. * Run regression of comscore with rurscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter rurscore /outfile=corv(ruralcorv). * Activate file of output from regression. dataset activate ruralcorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=rurconst rurscore=rurcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = ruralcorv /by ROWTYPE_. execute. dataset close urbancorv. dataset close ruralcorv. dataset activate assets. filter off. *** Calculate combined wealth score from Urban and Rural Scores. * Use coefficients from urban and rural regressions above. compute combscor=0. print formats combscor (f11.5). write formats combscor (f11.5). ** Urban. if (urban = 1) combscor=urbconst+urbcoeff*urbscore. ** Rural. if (rural = 1) combscor=rurconst+rurcoeff*rurscore. variable labels combscor 'Combined national wealth score'. execute. compute hhwt = QHWEIGHT/1000000. variable labels hhwt 'HH weights'. formats hhwt (f12.6). weight by hhwt. filter off. execute. frequencies variables=combscor comscore /format=notable /ntiles=5 /statistics=minimum maximum stddev mean /histogram normal /order=analysis. filter off. filter by urban. execute. frequencies variables=combscor urbscore /format=notable /ntiles=5 /statistics=minimum maximum stddev mean /histogram normal /order=analysis. filter off. filter by rural. execute. frequencies variables=combscor rurscore /format=notable /ntiles=5 /statistics=minimum maximum stddev mean /histogram normal /order=analysis. filter off. execute. *Calculate quintiles and scores for data file. compute hhmemwt=QHWEIGHT*hhusual/1000000. variable labels hhmemwt 'HH members weighting for index'. formats hhmemwt (f12.6). weight by hhmemwt. filter off. filter by urban. execute. rank variables=urbscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. filter by rural. execute. rank variables=rurscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. execute. rank variables=combscor (A) /rank /ntiles (5) /print=yes /ties=mean. variable labels ncombsco 'Combined wealth index' /nurbscor 'Urban wealth index' /nrurscor 'Rural wealth index'. value labels ncombsco nurbscor nrurscor 1 'Lowest' 2 'Second' 3 'Middle' 4 'Fourth' 5 'Highest'. *** Check on quintiles. frequencies variables=ncombsco nurbscor nrurscor. weight by hhwt. ctables /table ( QH101_11+QH101_12+QH101_13+QH101_14+QH101_15+QH101_16+QH101_21+QH101_31+QH101_32+QH101_41+QH101_42+QH101_51+QH101_61+QH101_71+QH101_81+QH101_82+QH101_96+ QH109_11+QH109_12+QH109_13+QH109_14+QH109_15+QH109_21+QH109_22+QH109_23+QH109_31+QH109_41+QH109_51+QH109_61+QH109_96+ QH109_11_sh+QH109_12_sh+QH109_13_sh+QH109_14_sh+QH109_15_sh+QH109_21_sh+QH109_22_sh+QH109_23_sh+QH109_31_sh+QH109_41_sh+QH109_51_sh+ QH113_1+QH113_2+QH113_3+QH113_4+QH113_5+QH113_6+QH113_95+QH113_96+ QH121A+QH121B+QH121C+QH121D+QH121E+QH121F+QH121G+QH121H+QH121I+QH121J+QH121K+QH121L+QH121M+QH121N+QH121O+QH121P+QH121Q+QH121R+QH121S+QH121T+QH121U+QH121V+ QH121W+QH121X+QH121Y+QH121Z+QH121AA+QH121AB+QH121AC+QH122A+QH122C+QH122D+QH122E+QH122F+QH122G+QH122H+MOBPHONE+CHECKACC+ QH142_11+QH142_21+QH142_31+QH142_32+QH142_33+QH142_34+QH142_35+ QH143_11+QH143_12+QH143_21+QH143_22+QH143_23+QH143_24+QH143_96+ QH144_12+QH144_21+QH144_31+QH144_32+QH144_41+QH144_42+QH144_43+QH144_44+ HOUSE+LAND+memsleep+ QH118A_1+QH118A_2+QH118A_3+QH118B_1+QH118B_2+ QH118C_1+QH118D_1+QH118D_2+ QH118E_1+QH118E_2+QH118E_3+QH118F_1+QH118F_2+QH118F_3+ QH118G_1+QH118G_2+QH118G_3+QH118H_1+QH118H_2+landarea )[S][Mean F8.3] by (ncombsco+nurbscor+nrurscor)[C] /slabels visible=no. * Alternative instead of ctables. *means tables= QH101_11 QH101_12 QH101_13 QH101_14 QH101_15 QH101_16 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_51 QH101_61 QH101_71 QH101_81 QH101_82 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_15 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_96 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_15_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_3 QH113_4 QH113_5 QH113_6 QH113_95 QH113_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH121H QH121I QH121J QH121K QH121L QH121M QH121N QH121O QH121P QH121Q QH121R QH121S QH121T QH121U QH121V QH121W QH121X QH121Y QH121Z QH121AA QH121AB QH121AC QH122A QH122C QH122D QH122E QH122F QH122G QH122H MOBPHONE CHECKACC QH142_11 QH142_21 QH142_31 QH142_32 QH142_33 QH142_34 QH142_35 QH143_11 QH143_12 QH143_21 QH143_22 QH143_23 QH143_24 QH143_96 QH144_12 QH144_21 QH144_31 QH144_32 QH144_41 QH144_42 QH144_43 QH144_44 QH144_96 HOUSE LAND memsleep QH118A_1 QH118A_2 QH118A_3 QH118B_1 QH118B_2 QH118C_1 QH118D_1 QH118D_2 QH118E_1 QH118E_2 QH118E_3 QH118F_1 QH118F_2 QH118F_3 QH118G_1 QH118G_2 QH118G_3 QH118H_1 QH118H_2 landarea by ncombsco nurbscor nrurscor /cells mean count stddev. graph /histogram(normal)=combscor /title= 'Distribution of Households by Wealth Scores'. frequencies variables=combscor /format=notable /ntiles=5 /statistics=stddev minimum maximum semean mean median mode skewness seskew kurtosis sekurt /order=analysis. weight off. filter off. write formats combscor urbscore rurscore (f11.5). * Save final dataset of assets. save outfile='assets.sav'. *** Write out scores file. write outfile='scores.dat' table /QHCLUST QHNUMBER combscor ncombsco urbscore nurbscor rurscore nrurscor. execute. * Produce table 2.6 weighted by de jure population to test. weight by hhmemwt. compute total = 0. variable labels total 'Total'. value labels total 0 ' '. ctables /vlabels variables=QHTYPE QHREGION total Ncombsco display=both /table QHTYPE [C] + QHREGION [C] + total [C] BY Ncombsco [C][rowpct.count '%' F8.1, totals [rowpct.count '%' F8.1, count '' F8.0]] /categories variables=Ncombsco total=yes /titles title='Table 2.6 Wealth Quintiles' '' 'Percent distribution of the de jure population by wealth quintiles, according to residence and region, Gabon DHS 2019-21' corner='Residence/region' /slabels visible=no.